package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class ISRDemo {
    public static void main(String[] args) throws IOException {
//       // FileOutputStream fis = new FileOutputStream("t1.txt");
//        File file = new File("t1.txt");
//        FileInputStream fis = new FileInputStream(file);
//        InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
//  //     String str = (String) ;
//       int d;
//       while ((d=isr.read())!=-1){
//           System.out.print((char)(d));
//       }
//        System.out.println();
//
//       // isr.read();
//        System.out.println("读取完毕");
//        isr.close();
//
//    }
        FileInputStream fis = new FileInputStream("t1.txt");
        InputStreamReader isr=new InputStreamReader(fis,StandardCharsets.UTF_8);

        int d;
        while ((d= isr.read())!=-1){
            System.out.print((char) d);
        }
        System.out.println();
        System.out.println("输出完毕!");

        isr.close();


    }

}
